package nio.nio.zeroCopy;

import java.io.DataInputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author 帅小伙
 * @date 2022/1/15
 * @description
 * 传统java服务器的io操作
 */
public class OldIOServer {

    public static void main(String[] args) throws Exception {
        ServerSocket serverSocket = new ServerSocket(7000);

        while(true){
            Socket socket = serverSocket.accept();
            DataInputStream dataInputStream = new DataInputStream(socket.getInputStream());

            byte[] bytes = new byte[1024];

            while(true){
                int readCount = dataInputStream.read(bytes,0,bytes.length);
                if(readCount == -1)break;
            }
        }
    }
}
